﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace PongXNA
{
    class Racket
    {
        public Racket(Texture2D texture2d )
        {
            SpriteRacket = texture2d;
            
        }
        public void RacketInit(Vector2 vectorposition,Rectangle hitbox,int taille)
        {
            VectorPosition = vectorposition;
            HitBox = hitbox;
            HitBox = new Rectangle(HitBox.X,HitBox.Y,HitBox.Width*taille,HitBox.Height*taille);
            //SpriteRacket = new Texture2D(GraphicsDevice,SpriteRacket.Width * taille,SpriteRacket.Height*taille);
        }
        private Rectangle _hitbox; // we need to have a hitbox for testing if an object touch them
        public Rectangle HitBox
        {
            get { return _hitbox; }
            set { _hitbox = value; }
        }

        private Vector2 _vectorposition;// we need to have a position for the Racket
        public Vector2 VectorPosition
        {
            get { return _vectorposition; }
            set { _vectorposition = value; }
        }

        private Texture2D _spriteracket;
        public Texture2D SpriteRacket
        {
            get { return _spriteracket; }
            set { _spriteracket = value; }
        }

        private int _currentscore;
        public int CurrentScore
        {
            get { return _currentscore; }
            set { _currentscore = value; }
        }

        private string _etat;
        public string Etat
        {
            get { return _etat; }
            set { _etat = value; }
        }

        public static float IA(float pointArriveeBall, double racketHeight, double ballHeight, int difficulty)
        {
            Random random = new Random(DateTime.Now.Millisecond);
            return pointArriveeBall + random.Next((int)(racketHeight +  2 * ballHeight - 2 + difficulty)) - (float)(racketHeight + 2 * ballHeight - 2 + difficulty);
        }

        
    }
}
